#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@author:shengwei
@file:asyncio_py.py
@time:2018/2/28 002814:25
"""

import threading
import asyncio


@asyncio.coroutine
def hello():
    print('Hello world! (%s)' % threading.currentThread())
    yield from asyncio.sleep(1)
    print('Hello again! (%s)' % threading.currentThread())


loop = asyncio.get_event_loop()
tasks = [hello(), hello()]
loop.run_until_complete(asyncio.wait(tasks))
loop.close()
